<?php

use Illuminate\Database\Seeder;
use Carbon\Carbon;
class BasicDataSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        /**
         * 客户数据
         */
        DB::table('basic_customers')->insert([
            [
                'code' => 'cu001',
                'name' => '旭光电子股份有限公司',
                'contact' => '李达',
                'mobile' => '18308656586',
                'telephone' => '',
                'fax' => '',
                'email' => '',
                'address' => '松花江路231号',
                'contract_sign_date' => Carbon::createFromFormat('Y-m-d', '2016-10-08')->toDateTimeString(),
                'serve_time_limit' => 5,
                'inspection_date' =>  Carbon::createFromFormat('Y-m-d', '2016-10-08')->toDateTimeString(),
                'expire_remind_time' => 10,
                'inspection_remind_time' => 5,
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ],
            [
                'code' => 'cu002',
                'name' => '成勋电子股份有限公司',
                'contact' => '冯林',
                'mobile' => '18308656582',
                'telephone' => '',
                'fax' => '',
                'email' => '',
                'address' => '场中路231号',
                'contract_sign_date' => Carbon::createFromFormat('Y-m-d', '2017-12-08')->toDateTimeString(),
                'serve_time_limit' => 3.5,
                'inspection_date' =>  Carbon::createFromFormat('Y-m-d', '2016-10-08')->toDateTimeString(),
                'expire_remind_time' => 10,
                'inspection_remind_time' => 5,
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ]
        ]);

        /**
         * 维护人员基础数据
         */
        DB::table('basic_maintainers')->insert([
            [
                'code' => 'admin',
                'name' => '管理员',
                'avatar' => '',
                'mobile' => '18308656580',
                'telephone' => '',
                'email' => '',
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ],
//            [
//                'code' => 'ma001',
//                'name' => '赵礼',
//                'avatar' => '',
//                'mobile' => '18308656587',
//                'telephone' => '',
//                'email' => '',
//                'created_at' => Carbon::now()->toDateTimeString(),
//                'updated_at' => Carbon::now()->toDateTimeString(),
//            ],
//            [
//                'code' => 'ma002',
//                'name' => '王法',
//                'avatar' => '',
//                'mobile' => '18308656588',
//                'telephone' => '',
//                'email' => '',
//                'created_at' => Carbon::now()->toDateTimeString(),
//                'updated_at' => Carbon::now()->toDateTimeString(),
//            ]
        ]);

//        /**
//         * 变电站基础数据
//         */
//        DB::table('basic_substations')->insert([
//            [
//                'code' => 'su001',
//                'name' => '10/0.4kV',
//                'address' => '松花江路231号',
//                'customer_code' => 'cu001',
//                'picture' => '',
//                'remark' => '',
//                'created_at' => Carbon::now()->toDateTimeString(),
//                'updated_at' => Carbon::now()->toDateTimeString(),
//            ],
//            [
//                'code' => 'su002',
//                'name' => '9/0.6kV',
//                'address' => '场中路231号',
//                'customer_code' => 'cu002',
//                'picture' => '',
//                'remark' => '',
//                'created_at' => Carbon::now()->toDateTimeString(),
//                'updated_at' => Carbon::now()->toDateTimeString(),
//            ]
//        ]);

        /**
         * 变压器基础数据
         */
        DB::table('basic_transformers')->insert([
            [
                'code' => 'tr001',
                'model_code' => 'XG001',
                'customer_transformer_code' => '100/10kVA',
                'customer_code' => 'cu001',
                'address' => '松花江路231号',
                'model' => '100',
                'capacity' => 500,
                'remark' => '',
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ],
            [
                'code' => 'tr002',
                'model_code' => 'CX001',
                'customer_transformer_code' => '101/1000kVA',
                'customer_code' => 'cu002',
                'address' => '场中路231号',
                'model' => '101',
                'capacity' => 0.8,
                'remark' => '',
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ]
        ]);

        /**
         * 采集器基础数据
         */
        DB::table('basic_collectors')->insert([
            [
                'code' => 'col001',
                'model' => 'CH2',
                'mac_code' => 'c1000001',
                'transformer_code' => 'tr001',
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ],
            [
                'code' => 'col002',
                'model' => 'CH2',
                'mac_code' => 'c1000002',
                'transformer_code' => 'tr002',
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ]
        ]);

        /**
         * 采集器采集的回路
         */
        DB::table('basic_circuits')->insert([
            [
                'code' => 'CIT001',
                'name'=>'回路一',
                'collector_code' => 'col001',
                'state' => '1',
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ],
            [
                'code' => 'CIT002',
                'name'=>'回路二',
                'collector_code' => 'col002',
                'state' => '1',
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ]
        ]);

        /**
         * 采集器采集的数据
         */
        DB::table('basic_collect_transformers')->insert([
            [
                'code' => 'CTSR001',
                'circuit_code' => 'CIT001',
                'temperature' => '30',
                'voltage' => '12',
                'electric' => '5',
                'process_state' => '0',
                'handler' => null,
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ],
            [
                'code' => 'CTSR002',
                'circuit_code' => 'CIT002',
                'temperature' => '50',
                'voltage' => '52',
                'electric' => '25',
                'process_state' => '0',
                'handler' => null,
                'created_at' => Carbon::now()->toDateTimeString(),
                'updated_at' => Carbon::now()->toDateTimeString(),
            ]
        ]);


    }
}
